package com.xur.springboot.mapper;

import com.xur.springboot.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

@Mapper
@Component
public interface UserMapper {

    //登录
    public User login(String username);

    //登陆时根据username、password查询id
    public int queryIdByUsername(String username,String password);

    //根据id查询用户信息
    public List <User> queryUserById(int id);

    /*添加用户实现注册功能*/
    int addUserInfo(User user);

    //查询所有用户信息
    List <User> queryUser();


    int updateUserStatus(@Param("userId") Integer userId, @Param("status") Integer status);

    List<User> queryUsersByDynamicFields(
            @Param("fields") List<String> fields,
            @Param("targetId") Integer targetId
    );

    // UserMapper.java
        List<User> queryUsersByIds(@Param("ids") List<Integer> ids);

}
